// Copyright (C) joyinter
// All rights reserved.
// 
// Author : Jiang Li
// Date   : 2004-11-20

#ifndef __BASE_THREAD_H_COMMON_SVR_BASE__
#define __BASE_THREAD_H_COMMON_SVR_BASE__

#pragma once

#include "..\..\common/base/thread.h"

namespace JoyServer
{

//##ModelId=44CEFAD100BD
class CJoyThread
{
protected:
	//##ModelId=44CEFAD100BE
    HANDLE  m_hThread;
	//##ModelId=44CEFAD100CB
    DWORD   m_threadId;

	//##ModelId=44CEFAD100CC
    static DWORD WINAPI sThreadProc(void*);
	//##ModelId=44CEFAD100CF
    virtual DWORD ThreadProc();
public:
	//##ModelId=44CEFAD100D1
    CJoyThread();
	//##ModelId=44CEFAD100D2
    virtual ~CJoyThread();

	//##ModelId=44CEFAD100D4
    virtual bool Create(bool bSuspend = false);
	//##ModelId=44CEFAD100DB
    virtual void Destroy();
};

//##ModelId=44CEFAD100DD
class CJoyAutoCS2
{
protected:
	//##ModelId=44CEFAD100DF
    CJoyCriticalSection& m_cs1;
	//##ModelId=44CEFAD100EB
    CJoyCriticalSection& m_cs2;
public:
	//##ModelId=44CEFAD100EF
    CJoyAutoCS2(CJoyCriticalSection& cs1, CJoyCriticalSection& cs2);
	//##ModelId=44CEFAD100FA
    ~CJoyAutoCS2();
};

} // namespace JoyServer

#endif  // __BASE_THREAD_H_COMMON_SVR_BASE__
